package com.lottery.material.dao.portal.article;

import com.lottery.material.dao.base.BaseDao;
import com.lottery.material.entity.article.ArticleInfo;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author houjie
 * @Description 帖子
 * @DATE Created on 2019-04-04 9:31
 */
@Repository
public interface ArticleInfoDao extends BaseDao<ArticleInfo, Integer> {

    /**
    * @Author: houjie
    * @Description: 根据用户id及圈子id查询当天的数据
    * @Date: 2019/4/9 16:57
    */
    @Query(value = "select ai from ArticleInfo ai where ai.userId = :userId and ai.circleId = :circleId and ai.createTime >= :nowDate order by ai.createTime desc")
    List<ArticleInfo> findTheDayByUserIdAndCircleId(@Param("userId") String userId,@Param("circleId") Integer circleId,@Param("nowDate") String nowDate);
}
